<?php

class CityParentAttrSave extends CActiveRecordBehavior{

	public function beforeSave($event) {
		$owner = $this->getOwner();
		$city = $owner->cityObj;
		$owner->parent_id = CHtml::value($city, 'parent.id','0');
		$owner->parent_name = CHtml::value($city, 'parent.name','其他');
	}
}

?>